8ae9ac217b41be4f84d27aeb53268753875d62fe,src/monkstone/MathToolModule.java,MathToolModule,constrainedMap,#ThreadContext#IRubyObject#IRubyObject[]#,66

Before Change


        double value = (Double) args[0].toJava(Double.class);
        RubyRange r1 = (RubyRange) args[1];
        RubyRange r2 = (RubyRange) args[2];
        double first1 = (Double) r1.first(context).toJava(Double.class);
        double first2 = (Double) r2.first(context).toJava(Double.class);
        double last1 = (Double) r1.last(context).toJava(Double.class);
        double last2 = (Double) r2.last(context).toJava(Double.class);
        double max = Math.max(first1, last1);
        double min = Math.min(first1, last1);
        if (value < min) {

After Change


        double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
        RubyRange r1 = (RubyRange) args[1];
        RubyRange r2 = (RubyRange) args[2];
        double first1 = (r1.first(context) instanceof RubyFloat)
                ? ((RubyFloat) r1.first(context)).getValue() : ((RubyFixnum) r1.first(context)).getDoubleValue();
        double first2 = (r2.first(context) instanceof RubyFloat)
                ? ((RubyFloat) r2.first(context)).getValue() : ((RubyFixnum) r2.first(context)).getDoubleValue();
        double last1 = (r1.last(context) instanceof RubyFloat)
                ? ((RubyFloat) r1.last(context)).getValue() : ((RubyFixnum) r1.last(context)).getDoubleValue();
        double last2 = (r2.last(context) instanceof RubyFloat)
                ? ((RubyFloat) r2.last(context)).getValue() : ((RubyFixnum) r2.last(context)).getDoubleValue();
        double max = Math.max(first1, last1);
        double min = Math.min(first1, last1);
        if (value < min) {